<%@ page language="java" pageEncoding="UTF-8"%>
<script>
function validateDate(type) {
	var selMonth = $("#company-task-create-month").val();
	if('' != selMonth && 'end' == type) {
		var startDateValue = $("#company-task-create-startDate").val();
		if('' == startDateValue) {
			alert('请先选择开始日期！');
			document.getElementById("company-task-create-startDate").focus();
			return false;
		}
	}
	if(selMonth && '' != selMonth) {
		var year = selMonth.substring(0, selMonth.indexOf("-"));
		var month = selMonth.substring(selMonth.indexOf("-") + 1);
		var first_date = new Date(year,month,1);
		var last_date = (new Date(first_date.getTime()-1000*60*60*24)).getDate();
		return selMonth + "-" + last_date;
	} else {
		alert('请先选择月份！');
		document.getElementById("company-task-create-month").focus();
		return false;
	}
}

$(function() {
	$('#company-task-create-companys').combotree({
		url : "${pageContext.request.contextPath }/userAction!getCompanyTree.action",
		multiple : true,
		required : true
	});
});
</script>
<div style="padding-top: 10px; padding-left: 20px">
	<form id="company-datareport-task-create">
		<span>月份：<input type="text" id="company-task-create-month" name="taskmonth" style="width:100px" class="easyui-validatebox" data-options="required:true" onFocus="WdatePicker({isShowClear:false,dateFmt:'yyyy-MM', minDate:'%y-%M'})" readonly> </span>&nbsp;&nbsp; 
		<span>开始日期：<input type="text" id="company-task-create-startDate" name="startDate" style="width:100px" class="easyui-validatebox" data-options="required:true" onFocus="var createmonth=validateDate();WdatePicker({isShowClear:false,dateFmt:'yyyy-MM-dd', minDate:'#F{$dp.$(\'company-task-create-month\').value+\'-01\'}', maxDate:createmonth})" readonly> </span>&nbsp;&nbsp; 
		<span>结束日期：<input type="text" id="company-task-create-endDate" name="endDate" style="width:100px" class="easyui-validatebox" data-options="required:true" onFocus="var createmonth=validateDate('end');WdatePicker({isShowClear:false,dateFmt:'yyyy-MM-dd', minDate:'#F{$dp.$D(\'company-task-create-startDate\')}', maxDate:createmonth})" readonly> </span>&nbsp;&nbsp; 
		<span>企业：<select id="company-task-create-companys" name="companys" style="width:200px;"></select></span>
	</form>
</div>
